<?php

namespace App\Mail;

use App\model\agent\AgentCounse;
use App\model\Area;
use App\model\City;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;

class ZiXunMail extends Mailable
{
    use Queueable, SerializesModels;
    protected  $agentCounse;
    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct(AgentCounse $agentCounse)
    {
        $this->agentCounse=$agentCounse;
        $this->subject='昊信网站咨询';
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->markdown('emails.liuyan')->with([
            'name'=>$this->agentCounse->name,
            'mobile'=>$this->agentCounse->mobile,
            'sex'=>AgentCounse::$SexMap[$this->agentCounse->sex],
            'diqu'=>City::find($this->agentCounse->quyu_id)->title ?? '',
            'area'=>Area::find($this->agentCounse->area_id)->value ?? ''
        ]);
    }
}
